package hn.cch.framework.database;


import org.junit.Test;
import redis.clients.jedis.Jedis;

import java.util.UUID;

public class RedisDemo {

    @Test
    public void testJedis(){

        // 命令空间namespace使用冒号:分隔
        Jedis jedis = new Jedis("127.0.0.1", 6379, 1000);
        String result = jedis.auth("chench");
        jedis.connect();
        System.out.println(jedis.isConnected());

        result = jedis.select(1);
        // 随机键
        for (int i = 0; i < 10; i++) {
            String key = String.format("%s:%s", "namespace", UUID.randomUUID().toString());
            result = jedis.set(key, UUID.randomUUID().toString());
        }
        // result = jedis.debug(DebugParams.OBJECT(""));
        // System.out.println(result);
        jedis.close();
    }



}
